{extend name="admin/layout" /}
{block name="main"}
<div class="row">
    <div class="col-md-12">
        <div class="panel">
            <div class="panel-heading">社区商品管理<div class="pull-right"><a class="btn-xs btn-info" data-toggle="modal" data-target="#addModal"><i
                    class="fa fa-plus"></i> 添加</a></div></div>
            <div class="panel-body table-responsive">
                <table class="table table-hover table-striped">
                    <thead>
                    <tr>
                        <th width="50" class="hidden-xs text-center">ID</th>
                        <th class="text-center">商品名称</th>
                        <th class="text-center">价格</th>
                        <th class="text-center">添加时间</th>
                        <th class="text-center">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {volist name="sqlist" id="row"}
                    <tr>
                        <form method="post">
                            <input type="hidden" name="id" value="{$row.sqid}">
                            <input type="hidden" name="action" value="update">
                            <td class="text-center">{$row.sqid}</td>
                            <td class="text-center"><input type="text" name="name" value="{$row.name}"
                                                           placeholder="输入商品名称"></td>
                            <td class="text-center"><input type="text" name="price" value="{$row.price}"
                                                           placeholder="输入商品价格"></td>
                            <td class="text-center">{$row.addtime}</td>
                            <td class="text-center">
                                <input type="submit" value="修改" class="btn-xs btn-info">
                                <button class="btn-xs btn-danger"
                                        onclick="if(confirm('确认删除？')){window.location.href='?action=del&id={$row.sqid}'};return false;">
                                    删除
                                </button>
                            </td>
                        </form>
                    </tr>
                    {/volist}
                    </tbody>
                </table>
                <div class="text-center">{$pageList->showPage()}</div>
            </div>
        </div>
    </div>
</div>
<!-- 模态框（Modal） -->
<div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">添加商品</h4>
            </div>
            <form class="form-horizontal" method="post">
                <div class="modal-body">
                    <div class="col-xs-12">
                        <input type="hidden" name="action" value="add">
                        <div class="form-group">
                            <input type="text" name="name" class="form-control" placeholder="输入商品名称">
                        </div>
                        <div class="form-group">
                            <input type="text" name="price" class="form-control" placeholder="输入商品价格">
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <a type="button" class="btn btn-default" data-dismiss="modal">关闭</a>
                    <input type="submit" class="btn btn-primary" value="添加">
                </div>
            </form>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>
{/block}